package com.my.aslife.module.common;

/**
 * @author mayuan
 * @description 全局保存上传类型字符串
 */
public class UploadTypeThreadLocal {

    private static final ThreadLocal<String> threadLocal = new ThreadLocal<>();

    public static String getUploadType(){
        return threadLocal.get();
    }

    public static void setUploadType(String type){
        String name;
        if (UploadEnum.SFZ_FACE.getType().equals(type)) {
            name = UploadEnum.SFZ_FACE.getTypeCode();

        } else if (UploadEnum.SFZ_REVERSE.getType().equals(type)) {
            name = UploadEnum.SFZ_REVERSE.getTypeCode();

        } else  {
            name = UploadEnum.SOURCE.getTypeCode();
        }
        threadLocal.set(name);
    }

    public static void remove(){
        threadLocal.remove();
    }

}
